package cn.lg.soar.system.biz.modules.general.mapper;

import cn.lg.soar.system.biz.modules.general.entity.SerialNumber;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 文件业务关系表
 * @author 41225
 * @since 2024-06-02
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Mapper
public interface SerialNumberMapper extends BaseMapper<SerialNumber> {

    @Select("SELECT `serial` FROM lg_sys_serial WHERE id='${id}'")
    Integer getValue(@Param("id") String id);

    @Update("UPDATE lg_sys_serial SET `serial`=${newValue} WHERE id='${id}' AND `serial`=${oldValue}")
    int incrValue(@Param("id") String id, @Param("oldValue") int oldValue, @Param("newValue") int newValue);

}
